perf(index): parallelize kmeans centroid recomputation - #8560
Open
isaac-dasari wants to merge 3 commits into
Open
perf(index): parallelize kmeans centroid recomputation#8560isaac-dasari wants to merge 3 commits into
isaac-dasari wants to merge 3 commits into
Conversation
isaac-dasari
marked this pull request as ready for review
August 17, 2026 07:00
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The revision replaces dense per-worker accumulators with a stable membership-to-row index, preserving per-cluster accumulation order while removing repeated membership scans. The previously reproduced low-sample, default high-dimensional, and large-grid cases now match or beat base without reintroducing the large accumulator footprint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The previous implementation divided centroids among workers, but every worker scanned the complete input. That made centroid recomputation perform O(num_vectors * workers) input reads. This changes the input scan to O(num_vectors) while avoiding shared-write contention.
Closes #6369.
Validation
Passed locally:
cargo fmt --all -- --checkcargo check -p lance-index --tests --benches --profile bench -j 1cargo clippy -p lance-index --tests --benches --profile bench -j 1 -- -D warningsgit diff --checkThe optimized test/benchmark linker exceeded the available resources on the local 7.6 GiB development machine, so executable test and benchmark runs are intentionally delegated to GitHub Actions. The PR is draft pending those results.